﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassifierLib
{
    /// <summary>
    /// This class represents the output of a given rule in the system
    /// Derivitives allow different output types to be specified
    /// (This is similar to DiscreteOutput in the previous codebase)
    /// </summary>
    public class Action : IEquatable<Action>, IComparable<Action>, IComparable
    {
        // TODO: refactor this
        private double _value;
        public double Value
        {
            get
            {
                return _value;
            }
            set
            {
                _value = value;
            }
        }

        public Action()
        {
            _value = 0;
        }

        public Action(double Value)
        {
            _value = Value;
        }

        public override string ToString()
        {
            return Value.ToString();
        }

        // implement IEquatable so that comparison is based on data type rather than instance
        public bool Equals(Action other)
        {
            if (this._value == other.Value)
                return true;
            else
                return false;
        }

        #region IComparable Members

        public int CompareTo(object obj)
        {
            return this.CompareTo(obj as Action);
        }

        #endregion

        #region IComparable<Action> Members

        public int CompareTo(Action other)
        {
            return Value.CompareTo(other.Value);
        }

        #endregion
    }
}
